//
//  YHNetworkManager+Request.h
//  YHBaseProject
//
//  Created by yuhang liu on 2022/11/18.
//  Copyright © 2022 lyh. All rights reserved.
//

#import "YHNetworkManager.h"
#import "XMResponseTip.h"

NS_ASSUME_NONNULL_BEGIN

/// 完成completeBlock回调
typedef void (^YHCompleteBlock)(XMResponseTip *tip, id _Nullable result);


@interface YHNetworkManager (Request)

/// POST通用请求
/// - Parameters:
///   - url: 请求路径
///   - parameters: 参数
///   - completeBlock: 回调
- (void)postWithUrl:(NSString *)url
         parameters:(NSMutableDictionary *)parameters
      completeBlock:(YHCompleteBlock)completeBlock;

/// GET请求
/// - Parameters:
///   - url: 完整路径
///   - parameters: 参数
///   - completeBlock: 回调
- (void)getWithUrl:(NSString *)url
        parameters:(NSDictionary *)parameters
     completeBlock:(YHCompleteBlock)completeBlock;

/// 以Data的方式上传
/// - Parameters:
///   - fileData: data
///   - url: 请求地址
///   - parameters: 参数
///   - name: 服务器参数名称
///   - fileName: 文件名称 图片:xxx.jpg,xxx.png     视频:video.mov
///   - mimeType: 文件类型 图片:image/jpg,image/png 视频:video/quicktime 音频:audio/AMR
///   - progress: 上传进度
///   - completeBlock: 回调
- (void)uploadWithFileData:(NSData *)fileData
                       url:(NSString *)url
                parameters:(NSMutableDictionary *)parameters
                      name:(NSString *)name
                  fileName:(NSString *)fileName
                  mimeType:(NSString *)mimeType
                  progress:(void (^)(NSProgress *))progress
             completeBlock:(YHCompleteBlock)completeBlock;

/// 路径的方式上传
/// - Parameters:
///   - fileUrl: 路径Url
///   - parameters: 参数
///   - completeBlock: 回调
- (void)uploadWithFileUrl:(NSURL *)fileUrl
                      url:(NSString *)url
               parameters:(NSMutableDictionary *)parameters
                 progress:(void (^)(NSProgress *))progress
            completeBlock:(YHCompleteBlock)completeBlock;

@end

NS_ASSUME_NONNULL_END
